//
//  SCB_Products_ViewController.m
//  Time
//
//  Created by dllo on 16/8/1.
//  Copyright © 2016年 司昌宝. All rights reserved.
//

#import "SCB_Products_ViewController.h"
#import "SCB_Today_Default_detail_ViewController.h"


@interface SCB_Products_ViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,retain) UIButton *mainButton;

@property (nonatomic,retain) UITableView *productsTableView;

@end

@implementation SCB_Products_ViewController

-(void)dealloc{
    [_mainButton release];
    [_productsTableView release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.hidden = YES;
    
    [self handleDateForProducts];
    [self createMainButton];
    [self createTableView];
    
    [self.view bringSubviewToFront:self.mainButton];
}

-(void)createTableView{
    self.productsTableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
    [self.view addSubview:self.productsTableView];
    self.productsTableView.delegate = self;
    self.productsTableView.dataSource = self;
    [self.productsTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"SCB_Today_Prodcuts_TableView_Cell"];
}

-(void)createMainButton{
    self.mainButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:self.mainButton];
    self.mainButton.backgroundColor = [UIColor blackColor];
    [self.mainButton setImage:[UIImage imageNamed:@"列表"] forState:UIControlStateNormal];
    
    [self.mainButton mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view.mas_right).offset(-20);
        make.width.mas_equalTo(30);
        make.bottom.equalTo(self.view.mas_bottom).offset(-20);
        make.height.mas_equalTo(30);
    }];
    [self.mainButton addTarget:self action:@selector(mainButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}

-(void)mainButtonAction:(UIButton *)button{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SCB_Today_Prodcuts_TableView_Cell" forIndexPath:indexPath];
    
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 200.0;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(BOOL)prefersStatusBarHidden{
    return YES;
}

@end
